﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using IMedicare.Tool;

namespace Test
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();


            comboBox1.DataSource = ReadConfig.GetConfig();
            comboBox1.DisplayMember = "MedicareText";
            comboBox1.ValueMember = "MedicareValue";
        }

        private void button1_Click(object sender, EventArgs e)
        {

            /*
            字段名称
           交易代码
           交易金额
           pos流水号
           收银机号
           收银员号
           原终端号
           授权号
           原交易日期
           设备类型
           第一磁道
           第二磁道
           第三磁道
        */

            //PosChantEnity entity = new PosChantEnity();
            //entity.MerchanCode = "01";
            //entity.MerchanMoney = textBox1.Text;
            //entity.POSFlowNo = DateTime.Now.ToString("MMddss");
            //entity.CashMemberNo = "";
            //entity.CashRegNo = "";
            //entity.OrginTerminalNo = "";
            //entity.AuthorizationNo = "";
            //entity.OrginTranDT = "";
            //entity.TerminalType = "7";
            //entity.Track1 = "";
            //entity.Track2 = "5226085710076865=49121200352600812761";
            //entity.Track3 = "996226095710076865=1561560500050000001015812761214000049120=5710076865=000000000=00000000571000000000000";
         
            //PosChant chant = new PosChant();
            //chant.CandTrans(entity);
            

        }

        private void button2_Click(object sender, EventArgs e)
        {
          //  PosChantEnity entity = new PosChantEnity();
          //  entity.MerchanCode = "03";
          //  entity.MerchanMoney = textBox1.Text;
          //  entity.POSFlowNo = DateTime.Now.ToString("MMddss");
          //  entity.CashMemberNo = "";
          //  entity.CashRegNo = "";
          //  entity.OrginTerminalNo = "";
          //  entity.AuthorizationNo = "";
          //  entity.OrginTranDT = "";
          //  entity.TerminalType = "7";
          //  entity.Track1 = "";
          //  entity.Track2 = "5226085710076865=49121200352600812761";
          //  entity.Track3 = "996226095710076865=1561560500050000001015812761214000049120=5710076865=000000000=00000000571000000000000";

          //  PosChant chant = new PosChant();

          ////  textBox2.Text = chant.CandTransBalance(entity);

          //  PosChantOutputEntity en= chant.CandTrans(entity);
          //  textBox3.Text = en.MerchanMoney;


           // Action showbal = () => showBalance();
           // //showbal();
           // showbal.BeginInvoke(null, null);


           // Action showbal1 = () => getString("gaergaegae");
           //IAsyncResult ru=  showbal1.BeginInvoke(null,null);
           // //new Action(chant.CandTrans).BeginInvoke(null, null);


           // textBox2.Text = "正在查询查询";

           // showbal1.EndInvoke(ru);
           // textBox2.Text = "11111111111";

        }


        //private void showBalance()
        //{
        //    PosChantEnity entity = new PosChantEnity();
        //    entity.MerchanCode = "03";
        //    entity.MerchanMoney = textBox1.Text;
        //    entity.POSFlowNo = DateTime.Now.ToString("MMddss");
        //    entity.CashMemberNo = "";
        //    entity.CashRegNo = "";
        //    entity.OrginTerminalNo = "";
        //    entity.AuthorizationNo = "";
        //    entity.OrginTranDT = "";
        //    entity.TerminalType = "7";
        //    entity.Track1 = "";
        //    entity.Track2 = "5226085710076865=49121200352600812761";
        //    entity.Track3 = "996226095710076865=1561560500050000001015812761214000049120=5710076865=000000000=00000000571000000000000";

        //    PosChant chant = new PosChant();

        //    //  textBox2.Text = chant.CandTransBalance(entity);

        //    PosChantOutputEntity en = chant.CandTrans(entity);

        //    textBox3.Text = en.MerchanMoney;
        //}


        private void getString(string str)
        {
            textBox2.Text = str;
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show(comboBox1.SelectedValue.ToString());
        
        }


    }
}
